home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / i26-gunya2.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  4.3 KB  |  102 lines

  1. ;;; i26-gunya2.scm -*-scheme-*-
  2. ;;; Time-stamp: <1997/05/11 18:46:26 narazaki@InetQ.or.jp>
  3. ;;; Author: Shuji Narazaki (narazaki@InetQ.or.jp)
  4. ; ************************************************************************
  5. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  6. ; For use with GIMP 1.1.
  7. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  8. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  9. ; ************************************************************************
  10.  
  11. ;;; Comment:
  12. ;;;  This is the first font decoration of Imigre-26 (i26)
  13. ;;; Code:
  14.  
  15. (define (script-fu-i26-gunya2 text text-color frame-color font font-size frame-size)
  16.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  17.      (border (/ font-size 10))
  18.      (text-layer (car (gimp-text-fontname img -1 0 0 text (* border 2)
  19.                           TRUE font-size PIXELS font))) 
  20.      (width (car (gimp-drawable-width text-layer)))
  21.      (height (car (gimp-drawable-height text-layer)))
  22.      (dist-text-layer (car (gimp-layer-new img width height RGBA-IMAGE
  23.                            "Distorted text" 100 NORMAL-MODE)))
  24.      (dist-frame-layer (car (gimp-layer-new img width height RGBA-IMAGE
  25.                         "Distorted text" 100 NORMAL-MODE)))
  26.      (distortion-img (car (gimp-image-new width height GRAY)))
  27.      (distortion-layer (car (gimp-layer-new distortion-img width height
  28.                         GRAY-IMAGE "temp" 100 NORMAL-MODE)))
  29.      (radius (/ font-size 10))
  30.      (prob 0.5))
  31.  
  32.     (gimp-context-push)
  33.  
  34.     (gimp-image-undo-disable img)
  35.     (gimp-image-undo-disable distortion-img)
  36.     (gimp-image-resize img width height 0 0)
  37.     (gimp-image-add-layer img dist-text-layer -1)
  38.     (gimp-image-add-layer img dist-frame-layer -1)
  39.     (gimp-image-add-layer distortion-img distortion-layer -1)
  40.     (gimp-selection-none img)
  41.     (gimp-edit-clear dist-text-layer)
  42.     (gimp-edit-clear dist-frame-layer)
  43.     ;; get the text shape
  44.     (gimp-selection-layer-alpha text-layer)
  45.     ;; fill it with the specified color
  46.     (gimp-context-set-foreground text-color)
  47.     (gimp-edit-fill dist-text-layer FOREGROUND-FILL)
  48.     ;; get the border shape
  49.     (gimp-selection-border img frame-size)
  50.     (gimp-context-set-background frame-color)
  51.     (gimp-edit-fill dist-frame-layer BACKGROUND-FILL)
  52.     (gimp-selection-none img)
  53.     ;; now make the distortion data
  54.     (gimp-context-set-background '(255 255 255))
  55.     (gimp-edit-fill distortion-layer BACKGROUND-FILL)
  56.     (plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0)
  57.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  58.     (plug-in-c-astretch 1 distortion-img distortion-layer)
  59.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  60.     ;; OK, apply it to dist-text-layer
  61.     (plug-in-displace 1 img dist-text-layer radius radius 1 1
  62.               distortion-layer distortion-layer 0)
  63.     ;; make the distortion data once again fro the frame
  64.     (gimp-edit-fill distortion-layer BACKGROUND-FILL)
  65.     (plug-in-noisify 1 distortion-img distortion-layer FALSE prob prob prob 0.0)
  66.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  67.     (plug-in-c-astretch 1 distortion-img distortion-layer)
  68.     (plug-in-gauss-rle 1 distortion-img distortion-layer radius 1 1)
  69.     ;; then, apply it to dist-frame-layer
  70.     (plug-in-displace 1 img dist-frame-layer radius radius 1 1
  71.               distortion-layer distortion-layer 0)
  72.     ;; Finally, clear the bottom layer (text-layer)
  73.     (gimp-selection-all img)
  74.     (gimp-context-set-background '(255 255 255))
  75.     (gimp-edit-fill text-layer BACKGROUND-FILL)
  76.     ;; post processing
  77.     (gimp-image-set-active-layer img dist-text-layer)
  78.     (gimp-selection-none img)
  79.     (gimp-image-undo-enable img)
  80.     (gimp-image-delete distortion-img)
  81.     (gimp-display-new img)
  82.  
  83.     (gimp-context-pop)))
  84.  
  85.  
  86. (script-fu-register "script-fu-i26-gunya2"
  87.             _"Imigre-26..."
  88.             "Two-colored text by hand"
  89.             "Shuji Narazaki"
  90.             "Shuji Narazaki"
  91.             "1997"
  92.             ""
  93.             SF-STRING     _"Text"               "The GIMP"
  94.             SF-COLOR      _"Text color"         '(255 0 0)
  95.             SF-COLOR      _"Frame color"        '(0 34 255)
  96.             SF-FONT       _"Font"               "Becker"
  97.             SF-ADJUSTMENT _"Font size (pixels)" '(100 2 1000 1 10 0 1)
  98.             SF-ADJUSTMENT _"Frame size"         '(2 1 20 1 5 0 1))
  99.  
  100. (script-fu-menu-register "script-fu-i26-gunya2"
  101.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  102.